{% extends "personal_center/base.html" %}
{% load state_display %}
<!--固定资产付款创建页-->
{% block page_link %}
    <link rel="stylesheet" href="../../static/system_setup/css/style.css">
{% endblock %}


{% block style %}
    <style>
        .add_class {
            background: #1E90FF;
        }

        tr {
            height: 37px;
        }

        th {
            text-align: center;
        }

        tbody td {
            overflow: hidden;
            white-space: nowrap;
            text-overflow: ellipsis;
        }

        td:first-child, th:first-child {
            position: sticky;
            left: 0; /* 首行永远固定在左侧 */
            z-index: 1;
        }

        thead tr th {
            position: sticky;
            top: 0; /* 列首永远固定在头部  */
            background-color: #E8E8E8;
        }

        th:first-child {
            z-index: 2;
        }

        #tb_1 tr:hover {
            background: #cfcfcf;
        }

        .file {
            position: relative;
            display: inline-block;
            background: #D0EEFF;
            border: 1px solid #99D3F5;
            border-radius: 4px;
            padding: 4px 12px;
            overflow: hidden;
            color: #1E88C7;
            text-decoration: none;
            text-indent: 0;
            line-height: 20px;
        }

        .file input {
            position: absolute;
            font-size: 100px;
            right: 0;
            top: 0;
            opacity: 0;
        }

        .file:hover {
            background: #AADFFD;
            border-color: #78C3F3;
            color: #004974;
            text-decoration: none;
        }

        .top_tag {
            border-bottom: #01AAED solid 2px;
            color: #01AAED;
        }

        .tab_top {
            width: 100px;
            height: 40px;
            line-height: 40px;
            text-align: center;
            display: inline-block;
            cursor: pointer;
        }

        .button_for_control {
            width: 90px;
            height: 30px;
            border: 1px solid #99D3F5;
            background: #D0EEFF;
            border-radius: 4px;
            letter-spacing: 0;
            line-height: 30px;
            color: #089bab;
            margin: 5px 0;
        }

        #page_one button:hover {
            color: red;
        }
        {##}
        {#.shade {#}
        {#    position: fixed;#}
        {#    top: 45px;#}
        {#    left: 14%;#}
        {#    right: 0;#}
        {#    bottom: 0;#}
        {#    background-color: rgba(36, 36, 36, 0.5);#}
        {#    display: none;#}
        {#    z-index: 10000;#}
        {# }#}
        {##}
        .shade {
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background-color: rgba(36, 36, 36, 0.5);
            display: none;
            z-index: 10000;
        }

        .add_background {
            background: #A9A9A9;
        }

        .li-class {
            list-style: none;
            margin-top: 2%;
            color: #0b0b0b;
            cursor: pointer;
        }

        .a_tag_cla {
            display: block;
            /*超出隐藏*/
            overflow: hidden;
            /*禁止换行*/
            white-space: nowrap;
            /*超出用省略号代替*/
            text-overflow: ellipsis;
            height: 30px;
            line-height: 30px;
            padding-left: 1%;
        }
        #addForm {
            width: 800px;
            height: 620px;
            background: #F5F5F5;
            position: absolute;
            border: #dfdfdf solid 1px;
            margin: auto;
            border-radius: 3px;
            top: 50%;
            left: 50%;
            /* 实现鼠标拖拽使用css3效果 */
            transform: translate(-50%, -50%);
            z-index: 11110;
            font-size: 0;
        }

        /* 标题 */
        #title {
            display: flex;
            justify-content: space-between;
            box-sizing: border-box;
            padding: 0 10px;
            height: 50px;
            color: #0b0b0b;
            cursor: move;
            /*border: #dfdfdf solid 1px;*/
            width: 100%;background: #f4f7fa;border-top-left-radius: 5px;border-top-right-radius: 5px;
        }

        .search {
            width: 300px;
            display: flex;
            float: right;
            margin: 10px 0;
            margin-right: 1%;
            /*border: 1px solid red;*/
        }

        .search input {
            vertical-align: middle;
            float: left;
        / / 左浮动 flex: 4;
            height: 30px;
            width: 230px;
            outline: none;
            border: 1px solid #0070c1;
            box-sizing: border-box;
        / / 盒子模型，怪异IE盒子模型，width = content + border * 2 + padding * 2 padding-left: 10 px;
            border-bottom-left-radius: 3px;
            border-top-left-radius: 3px;
        }

        .search button {
            float: right;
            flex: 1;
            height: 30px;
            width: 70px;
            line-height: 30px;
            background-color: #0070c1;
            color: white;
            border-style: none;
            outline: none;
            border-bottom-right-radius: 3px;
            border-top-right-radius: 3px;
        }

        .search button i {
            font-style: normal;
        }

        .search button:hover {
            font-size: 16px;
        }

        #addForm2 {
            width: 800px;
            height: 600px;
            background: #F5F5F5;
            position: absolute;
            border: #dfdfdf solid 1px;
            margin: auto;
            border-radius: 3px;
            top: 50%;
            left: 50%;
            /* 实现鼠标拖拽使用css3效果 */
            transform: translate(-50%, -50%);
            z-index: 10100;
            font-size: 0;
        }
        #title2 {
            display: flex;
            justify-content: space-between;
            box-sizing: border-box;
            padding: 0 10px;
            height: 40px;
            color: #0b0b0b;
            cursor: move;
            border-bottom: #dfdfdf solid 1px;
            width: 100%;background: #f4f7fa;border-top-left-radius: 5px;border-top-right-radius: 5px;
        }
        .a_tag_cla{
            display: block;overflow: hidden;white-space: nowrap;text-overflow: ellipsis;height: 30px;line-height: 30px;padding-left: 1%;
        }
    </style>
{% endblock %}


{% block right_content %}
    <div class="headline">
        <div id="DW_tag" class="tab_top top_tag" onclick="change_mind('DW')">
            申请详情
        </div>
        <div id="lct_tag" class="tab_top" onclick="change_mind('lct')">
            流程图
        </div>
        <div id="LH_tag" class="tab_top" onclick="change_mind('LH')">
            附件
        </div>

        <div id="" style="width: 100px;float: right;text-align: center;margin-right: 1%;height: 40px;">
            <button id="" onmousemove="page_zhanshi()" onmouseout="page_yincang()"
                    style="width: 100px;height: 30px;line-height: 27px;border: #1E90FF solid 1px;background: #1E90FF;color: white;margin-top: 5px;border-radius: 3px;">
                操作
            </button>
        </div>
        <div style="width: 110px;float: right;text-align: center;margin-right: 6px;height: 40px;">
            <button style="line-height: 27px;border-radius: 3px;border: #1E90FF solid 0.5px;width: 100px;height: 30px;margin-top: 5px;background: #1E90FF;color: white;">
                <a href="javascript:history.go(-1)" style="color: white;">返回</a></button>
        </div>
        <!-- 操作按钮隐藏块 -->
        <div id="page_one" onmousemove="page_zhanshi()" onmouseout="page_yincang()"
             style="z-index: 1000; position: absolute; width: 100px; height: auto;right: 0.9%; top: 80px;background: #FFFFFF; box-shadow: rgb(204 204 204) 2px 2px 10px;padding: 5px;display: none;">
            <button onclick="print_topics()" class="button_for_control">
                打印
            </button>
            {% if is_audit == 'true' and is_edit == 'false' %}
                {% if ApprovalType == "approval" %}
                    <button id="approve" onclick="online_tag()" class="button_for_control">
                        审批
                    </button>
                {% else %}
                    <button id="approve" onclick="summit_data('1')" class="button_for_control">
                        接收
                    </button>
                {% endif %}
            {% endif %}

            {% if is_stop == 'true' and is_edit == 'false' %}
                <button id="is_stop" onclick="operate_button(this.id)" class="button_for_control">
                    终止
                </button>
            {% endif %}

            {% if is_edit == 'true' %}
                <button id="add_station" type="button" class="button_for_control" onclick="ExportCar()">
                    提交
                </button>
            {% endif %}
        </div>
    </div>
    <hr>

    <div id="new_models" style="width: 100%;height: 100%;position: absolute;background-color: rgba(36, 36, 36, 0.3);z-index: 11000;top: 0;left: 0;display: none;">
        <div id="share" style="width: 700px;height: 500px;background: #F5F5F5;z-index: 10100;position: absolute;transform:translate(-50%,-50%);border-radius: 3px;border: #dfdfdf solid 1px;top: 45%;left: 50%;">
            <div id="box" style="width: 100%;height: 50px;background: #f4f7fa;cursor: move;border-top-left-radius: 5px;border-top-right-radius: 5px;">
                <h5 id="modal-title" class="modal-title" style="line-height: 50px;margin-left: 1%;display: inline-block;">审批</h5>
                <span onclick="close_models()" style="float: right;line-height: 50px;padding-right: 2%;cursor: pointer;"><i class="iconfont icon-quchu"></i></span>
            </div>
            <hr>
            <div style="height: 400px;width: 100%;padding-top: 2%;padding-left: 2%;">
                <div style="width: 100%">
                    <div style="display: inline-block; width: 100%;">
                        <label style="vertical-align: top;">审&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;批</label>
                        <input type="radio" name="approve" value="audit" checked>同意
                        <input style="margin-left: 3%;" type="radio" name="approve" value="draft">不同意
                    </div>
                </div>
                <div style="margin-top: 2%;width: 100%;">
                    <label style="vertical-align: top;">意&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;见</label>
                    <textarea name="" id="opinion_detail" cols="30" rows="10" style="width: 80%;outline: none;"></textarea>
                </div>
            </div>
            <hr>
            <div style="width: 100%;height: 50px;text-align: right;padding-right: 2%; position: absolute; bottom: 0; right: 18px;">
                <button onclick="summit_data()" style="width: 100px;height: 30px;border: #dfdfdf solid 1px;margin-top: 10px;border-radius: 3px;background: #1E90FF;color: white;">
                    提交
                </button>
            </div>
        </div>
    </div>

    <div id="DW" style="width: 100%;height: 95%;background: white;overflow: auto;">
        <div id="menu_from" style="width: 100%;height: auto;color: #2C3E50;display: inline-block;vertical-align: top;background: white;">
            <div style="width: 100%;height: 90%;display: inline-block;vertical-align: center;">
                <div style="width: 95%;margin-left: 2.5%;">
                    <table style="width: 100%;margin-top: 20px;">
                        <tr>
                            <td colspan="4" style="width: 95%;margin-left: 2.5%;height: 40px;padding-left: 0.5%;line-height: 40px;border: #cfcfcf solid 1px;text-align: center;">
                                <h3 id="form_name" style="letter-spacing: 8px;">快捷用印授权</h3>
                            </td>
                        </tr>
                        <tr>
                            <td colspan="4" style="width: 95%;margin-left: 2.5%;height: 40px;padding-left: 0.5%;line-height: 40px;background: #F5F5F5;border: #cfcfcf solid 1px;border-top: none;">基本信息</td>
                        </tr>
                        <tr style="margin-left: 1%;">
                            <td style="width: 10%;border: #cfcfcf solid 0.5px;text-align: right;height: 35px;line-height: 35px;letter-spacing: 2px;padding-right: 1%;">
                                申&nbsp;请&nbsp;人
                            </td>
                            <td id="applicat" style="width: 40%;height: 35px;line-height: 35px;padding-left: 1%;border: #cfcfcf solid 0.5px;">{{ obj.apply_user.real_name }}</td>

                            <td style="width: 10%;border: #cfcfcf solid 0.5px;text-align: right;height: 35px;line-height: 35px;padding-right: 1%;">
                                申请部门
                            </td>
                            <td id="department" style="width: 40%;border: #cfcfcf solid 0.5px;padding-left: 1%;line-height: 35px;">{{ obj.company.name }}</td>
                        </tr>
                        <tr style="margin-left: 1%;">
                            <td style="width: 10%;border: #cfcfcf solid 0.5px;text-align: right;height: 35px;line-height: 35px;padding-right: 1%;">
                                生效时间
                            </td>
                            <td id="take_effect_time" style="width: 30%;border: #cfcfcf solid 0.5px;padding-left: 1%;line-height: 35px;">{{ obj.take_effect_time }}</td>
                            <td style="width: 10%;border: #cfcfcf solid 0.5px;text-align: right;height: 35px;line-height: 35px;padding-right: 1%;">
                                失效时间
                            </td>
                            <td id="lose_efficacy_time" style="width: 50%;height: 35px;line-height: 35px;padding-left: 1%;border: #cfcfcf solid 0.5px;">
                                {{ obj.lose_efficacy_time }}
                            </td>
                        </tr>
                        <tr style="margin-left: 1%;">
                            <td style="width: 10%;border: #cfcfcf solid 0.5px;text-align: right;height: 35px;line-height: 35px;padding-right: 1%;">
                                申请类型
                            </td>
                            <td colspan="3" id="shenqing_type" style="width: 90%;border: #cfcfcf solid 0.5px;padding-left: 1%;line-height: 35px;">{{ obj.authorization_type }}</td>
                        </tr>
                    </table>
                    <table id="leimuId" style="width: 100%;">
                        <tr style="margin-left: 1%;">
                            <td colspan="6" style="width: 95%;margin-left: 2.5%;height: 40px;padding-left: 0.5%;line-height: 40px;background: #F5F5F5;border: #cccccc solid 1px;border-top: none;">
                                授权详情
                                {% if is_edit == 'true' %}
                                    <span style="float: right;padding-right: 10px;color: #00a0e9;cursor: pointer;" onclick="add_other()">添加</span>
                                {% endif %}
                            </td>
                        </tr>
                        <tr style="margin-left: 1%;">
                            <th style="width: 10%;border: #cfcfcf solid 0.5px;text-align: center;height: 35px;line-height: 35px;">序号</th>
                            <th style="width: 40%;border: #cfcfcf solid 0.5px;text-align: center;height: 35px;line-height: 35px;">
                                授权印章
                            </th>
                            <th style="width: 25%;border: #cfcfcf solid 0.5px;text-align: center;height: 35px;line-height: 35px;">
                                授权类目
                            </th>
                            <th style="width: 25%;border: #cfcfcf solid 0.5px;text-align: center;height: 35px;line-height: 35px;">
                                授权级别
                            </th>
                        </tr>

                        {% if reason|length %}
                            {% for foo in reason %}
                                <tr style="margin-left: 1%;">
                                    <td class="leimuxuhao" style="width: 10%;border: #cfcfcf solid 0.5px;text-align: center;height: 35px;line-height: 35px;">{{ foo.xuhao }}</td>
                                    <td style="width: 40%;border: #cfcfcf solid 0.5px;text-align: center;height: 35px;line-height: 35px;">
                                        {% if is_edit == 'false' %}
                                            {% for seal in seal_obj %}
                                                {% if foo.yinzhang == seal.id %}
                                                    {{ seal.seal_name }}
                                                {% endif %}
                                            {% endfor %}
                                        {% else %}
                                            {% if obj.authorization_type == '法人授权' %}
                                                <select name="choose_seal" id="" style="width: 100%;height: 100%;border: none;outline: none;">
                                                    {% for seal in seal_obj %}
                                                        <option value="{{ seal.id }}" {% if foo.yinzhang == seal.id %} selected {% endif %} style="text-align: center;">{{ seal.seal_name }}</option>
                                                    {% endfor %}
                                                </select>
                                            {% else %}
                                                京山市人民医院公章
                                            {% endif %}
                                        {% endif %}
                                    </td>
                                    <td class="leimuneirong" id="span_{{ foo.xuhao }}" style="width: 25%;border: #cfcfcf solid 0.5px;height: 35px;line-height: 35px;padding-left: 0.5%;text-align: center;">
                                        {{ foo.neirong }}
                                    </td>
                                    <td class="shouquan_leval" style="width: 22.5%;border: #cfcfcf solid 0.5px;text-align: center;height: 35px;line-height: 35px;cursor: pointer;">
                                        {{ foo.leval }}
                                    </td>
                                </tr>
                            {% endfor %}
                        {% else %}
                            <tr style="margin-left: 1%;">
                                <td class="leimuxuhao" style="width: 5%;border: #cfcfcf solid 0.5px;text-align: center;height: 35px;line-height: 35px;">1</td>
                                <td style="width: 25%;border: #cfcfcf solid 0.5px;text-align: center;height: 35px;line-height: 35px;">
                                    <select name="choose_seal" id="" style="width: 100%;height: 100%;border: none;outline: none;">
                                        {% for seal in seal_obj %}
                                            <option value="{{ seal.id }}">{{ seal.seal_name }}</option>
                                        {% endfor %}
                                    </select>
                                </td>
                                <td class="leimuneirong" id="span_1" onclick="model_inline(this.id)" style="width: 50%;border: #cfcfcf solid 0.5px;text-align: left;height: 35px;line-height: 35px;cursor: pointer;color: #cccccc;">
                                    请填写授权类目
                                </td>
                                <td style="width: 20%;border: #cfcfcf solid 0.5px;text-align: left;cursor: pointer;">
                                    <div id="shouquan_type_1" style="outline: none;display: -moz-inline-box; display: inline-block;width:95%;cursor: pointer;">
                                    </div>
                                </td>
                            </tr>
                        {% endif %}
                    </table>
                    <table style="width: 100%;">
                        <tr>
                            <td colspan="4"
                                style="width: 90%;height: 40px;margin-left: 5%;line-height: 40px;background-color: #F5F5F5;padding-left: 0.5%;border: #cccccc solid 0.5px;padding-right: 1%;border-top: none;">
                                审批详情
                            </td>
                        </tr>
                        {% if 'one' in audit_dic %}
                            <tr style="width: 100%;">
                                <td style="width: 10%;height: 150px;border: #cccccc solid 1px;text-align: right;padding-right: 1%;border-top: none;letter-spacing: 2.5px;">
                                    <p style="letter-spacing: 3px;">审&nbsp;计&nbsp;科&nbsp;审&nbsp;批</p>
                                </td>
                                <td colspan="5" style="width: 90%;height: 150px;border: #cccccc solid 1px;border-left: none;border-top: none;padding-left: 1%;">
                                    {% for k,v in audit_dic.items %}
                                        {% if k == 'one' %}
                                            {% for item in v %}
                                                {% if item.state != 'unaudit' %}
                                                    <div style="width: 100%;line-height: 20px;position: relative;">
                                                        <span>{{ item.state_display }}</span>
                                                        <span style="margin-left: 3%">{{ item.audit_note }}</span>
                                                    </div>
                                                    <div>
                                                        {% if item.signature_picture %}
                                                            <img src="{{ item.signature_picture }}" alt="" style="width: 150px; height: 60px;">
                                                        {% else %}
                                                            {{ item.audit_user }}
                                                        {% endif %}
                                                    </div>
                                                    <div style="text-align: right;color: #0b0b0b;">{{ item.audit_time }}</div>
                                                {% endif %}
                                            {% endfor %}
                                        {% endif %}
                                    {% endfor %}
                                </td>
                            </tr>
                        {% endif %}

                        {% if 'two' in audit_dic %}
                            <tr style="width: 100%;">
                                <td style="width: 10%;height: 150px;border: #cccccc solid 1px;text-align: right;padding-right: 1%;border-top: none;letter-spacing: 2.5px;">
                                    <p style="letter-spacing: 3px;">院&nbsp;&nbsp;长&nbsp;&nbsp;授&nbsp;&nbsp;权</p>
                                </td>
                                <td colspan="5" style="width: 90%;height: 150px;border: #cccccc solid 1px;border-left: none;border-top: none;padding-left: 1%;">
                                    {% for k,v in audit_dic.items %}
                                        {% if k == 'two' %}
                                            {% for item in v %}
                                                {% if item.state != 'unaudit' %}
                                                    <div style="width: 100%;line-height: 20px;position: relative;">
                                                        <span>{{ item.state_display }}</span>
                                                        <span style="margin-left: 3%">{{ item.audit_note }}</span>
                                                    </div>
                                                    <div>
                                                        {% if item.signature_picture %}
                                                            <img src="{{ item.signature_picture }}" alt="" style="width: 150px; height: 60px;">
                                                        {% else %}
                                                            {{ item.audit_user }}
                                                        {% endif %}
                                                    </div>
                                                    <div style="text-align: right;color: #0b0b0b;">{{ item.audit_time }}</div>
                                                {% endif %}
                                            {% endfor %}
                                        {% endif %}
                                    {% endfor %}
                                </td>
                            </tr>
                        {% endif %}

                        {% if 'three' in audit_dic %}
                            <tr style="width: 100%;">
                                <td style="width: 10%;height: 150px;border: #cccccc solid 1px;text-align: right;padding-right: 1%;border-top: none;">
                                    {% if obj.quick|search_model == '1' and obj.authorization_type == '法人授权' %}
                                        分&nbsp;管&nbsp;领&nbsp;导&nbsp;接&nbsp;收
                                    {% else %}
                                        分&nbsp;管&nbsp;领&nbsp;导&nbsp;授&nbsp;权
                                    {% endif %}
                                </td>
                                <td colspan="5" style="width: 90%;height: 150px;border: #cccccc solid 1px;border-left: none;border-top: none;padding-left: 1%;">
                                    {% for k,v in audit_dic.items %}
                                        {% if k == 'three' %}
                                            {% for item in v %}
                                                {% if item.state != 'unaudit' %}
                                                    <div style="width: 100%;line-height: 20px;position: relative;">
                                                        {% if obj.quick|search_model == '1' and obj.authorization_type == '法人授权' %}
                                                            已接受
                                                        {% else %}
                                                            同意
                                                        {% endif %}
                                                    </div>
                                                    <div>
                                                        {% if item.signature_picture %}
                                                            <img src="{{ item.signature_picture }}" alt="" style="width: 150px; height: 60px;">
                                                        {% else %}
                                                            {{ item.audit_user }}
                                                        {% endif %}
                                                    </div>
                                                    <div style="text-align: right;color: #0b0b0b;">{{ item.audit_time }}</div>
                                                {% endif %}
                                            {% endfor %}
                                        {% endif %}
                                    {% endfor %}
                                </td>
                            </tr>
                        {% endif %}

                        {% if 'four' in audit_dic %}
                            <tr style="width: 100%;">
                                <td style="width: 10%;height: 150px;border: #cccccc solid 1px;text-align: right;padding-right: 1%;border-top: none;">
                                    {% if obj.quick|search_model == '1' and obj.authorization_type == '法人授权' %}
                                        <p style="letter-spacing: 5px;">接&nbsp;&nbsp;&nbsp;收&nbsp;&nbsp;&nbsp;人</p>
                                    {% elif obj.quick|search_model == '2' and obj.authorization_type == '法人授权' %}
                                        <p style="letter-spacing: 5px;">接&nbsp;&nbsp;&nbsp;收&nbsp;&nbsp;&nbsp;人</p>
                                    {% elif obj.quick|search_model == '3' and obj.authorization_type == '法人授权' %}
                                        <p style="letter-spacing: 2px;">科室负责人授权</p>
                                    {% elif obj.quick|search_model == '1' and obj.authorization_type == '分管授权' %}
                                        <p style="letter-spacing: 5px;">接&nbsp;&nbsp;&nbsp;收&nbsp;&nbsp;&nbsp;人</p>
                                    {% else %}
                                        <p style="letter-spacing: 2px;">科室负责人授权</p>
                                    {% endif %}
                                </td>
                                <td colspan="5" style="width: 90%;height: 150px;border: #cccccc solid 1px;border-left: none;border-top: none;padding-left: 1%;">
                                    {% for k,v in audit_dic.items %}
                                        {% if k == 'four' %}
                                            {% for item in v %}
                                                {% if item.state != 'unaudit' %}
                                                    <div style="width: 100%;line-height: 20px;position: relative;">
                                                        {% if 'five' in audit_dic %}
                                                            <p>同意</p>
                                                            <p>{{ item.audit_note }}</p>
                                                        {% else %}
                                                            <p>已接收</p>
{#                                                            <p style="margin-top: 5px;">被授权人：{{ name_list }}</p>#}
                                                        {% endif %}
                                                    </div>
                                                    <div>
                                                        {% if item.signature_picture %}
                                                            <img src="{{ item.signature_picture }}" alt="" style="width: 150px; height: 60px;">
                                                        {% else %}
                                                            {{ item.audit_user }}
                                                        {% endif %}
                                                    </div>
                                                    <div style="text-align: right;color: #0b0b0b;">{{ item.audit_time }}</div>
                                                {% endif %}
                                            {% endfor %}
                                        {% endif %}
                                    {% endfor %}
                                </td>
                            </tr>
                        {% endif %}

                        {% if 'five' in audit_dic %}
                            <tr style="width: 100%;">
                                <td style="width: 10%;height: 150px;border: #cccccc solid 1px;text-align: right;padding-right: 1%;border-top: none;letter-spacing: 5px;">
                                    接&nbsp;&nbsp;&nbsp;收&nbsp;&nbsp;&nbsp;人
                                </td>
                                <td colspan="5" style="width: 90%;height: 150px;border: #cccccc solid 1px;border-left: none;border-top: none;padding-left: 1%;">
                                    {% for k,v in audit_dic.items %}
                                        {% if k == 'five' %}
                                            {% for item in v %}
                                                {% if item.state != 'unaudit' %}
                                                    <div style="width: 100%;line-height: 20px;position: relative;">
                                                        <p>已接收</p>
                                                    </div>
                                                    <div>
                                                        {% if item.signature_picture %}
                                                            <img src="{{ item.signature_picture }}" alt="" style="width: 150px; height: 60px;">
                                                        {% else %}
                                                            {{ item.audit_user }}
                                                        {% endif %}
                                                    </div>
                                                    <div style="text-align: right;color: #0b0b0b;">{{ item.audit_time }}</div>
                                                {% endif %}
                                            {% endfor %}
                                        {% endif %}
                                    {% endfor %}
                                </td>
                            </tr>
                        {% endif %}
                    </table>
                </div>
            </div>
        </div>
    </div>

    <div id="lct" style="width: 100%;height: 94%;background: white;display: none;">
        <div style="width: 100%;height: 40%;text-align: center;margin: 20% auto;">
            <div style="display: inline-block;vertical-align: top;cursor: pointer;text-align: center;">
                <div style="text-align: center;color: #0d8ddb;">
                    ({{ obj.apply_user.real_name }})<br>
                    发起人
                </div>
                <div style="width: 50px;height: 25px;border-radius: 3px;background: #0d8ddb;color: white;text-align: center;display: inline-block;font-size: 12px;line-height: 25px;">
                    start
                </div>
            </div>

            {% if 'one' in flow_dict %}
                {% for k,v in flow_dict.items %}
                    {% if k == 'one' %}
                        <div style="display: inline-block;border: {% if v.apply == 'true' %} #0d8ddb {% else %} #cfcfcf {% endif %} solid 1px;width: 120px;vertical-align: bottom;margin-bottom: 12px;"></div>
                        <div style="display: inline-block;vertical-align: top;cursor: pointer;text-align: center;">
                            <div style="text-align: center;{% if v.apply == 'true' %} color: #0d8ddb; {% endif %}">
                                ({{ v.apply_people }})<br>
                                审计科审批
                            </div>
                            <div style="width: 25px;height: 25px;border-radius: 50%;{% if v.apply == 'true' %} background: #0d8ddb; {% else %} background: #cfcfcf; {% endif %}color: white;text-align: center;display: inline-block;font-size: 12px;line-height: 25px;">
                                {{ v.sear }}
                            </div>
                        </div>
                    {% endif %}
                {% endfor %}
            {% endif %}

            {% if 'two' in flow_dict %}
                {% for k,v in flow_dict.items %}
                    {% if k == 'two' %}
                        <div style="display: inline-block;border: {% if v.apply == 'true' %} #0d8ddb {% else %} #cfcfcf {% endif %} solid 1px;width: 120px;vertical-align: bottom;margin-bottom: 12px;"></div>
                        <div style="display: inline-block;vertical-align: top;cursor: pointer;text-align: center;">
                            <div style="text-align: center;{% if v.apply == 'true' %} color: #0d8ddb; {% endif %}">
                                ({{ v.apply_people }})<br>
                                院长授权
                            </div>
                            <div style="width: 25px;height: 25px;border-radius: 50%;{% if v.apply == 'true' %} background: #0d8ddb; {% else %} background: #cfcfcf; {% endif %}color: white;text-align: center;display: inline-block;font-size: 12px;line-height: 25px;">
                                {{ v.sear }}
                            </div>
                        </div>
                    {% endif %}
                {% endfor %}
            {% endif %}

            {% if 'three' in flow_dict %}
                {% for k,v in flow_dict.items %}
                    {% if k == 'three' %}
                        <div style="display: inline-block;border: {% if v.apply == 'true' %} #0d8ddb {% else %} #cfcfcf {% endif %} solid 1px;width: 120px;vertical-align: bottom;margin-bottom: 12px;"></div>
                        <div style="display: inline-block;vertical-align: top;cursor: pointer;text-align: center;">
                            <div style="text-align: center;{% if v.apply == 'true' %} color: #0d8ddb; {% endif %}">
                                ({{ v.apply_people }})<br>
                                {% if obj.quick|search_model == '1' and obj.authorization_type == '法人授权' %}
                                    分&nbsp;管&nbsp;领&nbsp;导&nbsp;接&nbsp;收
                                {% else %}
                                    分&nbsp;管&nbsp;领&nbsp;导&nbsp;授&nbsp;权
                                {% endif %}
                            </div>
                            <div style="width: 25px;height: 25px;border-radius: 50%;{% if v.apply == 'true' %} background: #0d8ddb; {% else %} background: #cfcfcf; {% endif %}color: white;text-align: center;display: inline-block;font-size: 12px;line-height: 25px;">
                                {{ v.sear }}
                            </div>
                        </div>
                    {% endif %}
                {% endfor %}
            {% endif %}

            {% if 'four' in flow_dict %}
                {% for k,v in flow_dict.items %}
                    {% if k == 'four' %}
                        <div style="display: inline-block;border: {% if v.apply == 'true' %} #0d8ddb {% else %} #cfcfcf {% endif %} solid 1px;width: 120px;vertical-align: bottom;margin-bottom: 12px;"></div>
                        <div style="display: inline-block;vertical-align: top;cursor: pointer;text-align: center;">
                            <div style="text-align: center;{% if v.apply == 'true' %} color: #0d8ddb; {% endif %}">
                                ({{ v.apply_people }})<br>
                                {% if obj.quick|search_model == '1' and obj.authorization_type == '法人授权' %}
                                    接收人
                                {% elif obj.quick|search_model == '2' and obj.authorization_type == '法人授权' %}
                                    接收人
                                {% elif obj.quick|search_model == '3' and obj.authorization_type == '法人授权' %}
                                    科主任授权
                                {% elif obj.quick|search_model == '1' and obj.authorization_type == '分管授权' %}
                                    接收人
                                {% else %}
                                    科主任授权
                                {% endif %}
                            </div>
                            <div style="width: 25px;height: 25px;border-radius: 50%;{% if v.apply == 'true' %} background: #0d8ddb; {% else %} background: #cfcfcf; {% endif %}color: white;text-align: center;display: inline-block;font-size: 12px;line-height: 25px;">
                                {{ v.sear }}
                            </div>
                        </div>
                    {% endif %}
                {% endfor %}
            {% endif %}

            {% if 'five' in flow_dict %}
                {% for k,v in flow_dict.items %}
                    {% if k == 'five' %}
                        <div style="display: inline-block;border: {% if v.apply == 'true' %} #0d8ddb {% else %} #cfcfcf {% endif %} solid 1px;width: 120px;vertical-align: bottom;margin-bottom: 12px;"></div>
                        <div style="display: inline-block;vertical-align: top;cursor: pointer;text-align: center;">
                            <div style="text-align: center;{% if v.apply == 'true' %} color: #0d8ddb; {% endif %}">
                                ({{ v.apply_people }})<br>
                                接收人
                            </div>
                            <div style="width: 25px;height: 25px;border-radius: 50%;{% if v.apply == 'true' %} background: #0d8ddb; {% else %} background: #cfcfcf; {% endif %}color: white;text-align: center;display: inline-block;font-size: 12px;line-height: 25px;">
                                {{ v.sear }}
                            </div>
                        </div>
                    {% endif %}
                {% endfor %}
            {% endif %}

            <div style="display: inline-block;border: #0d8ddb solid 1px;width: 120px;vertical-align: bottom;margin-bottom: 12px;"></div>
            <div style="display: inline-block;vertical-align: top;cursor: pointer;text-align: center;">
                <div style="text-align: center;color: #0d8ddb;">
                    <span style="visibility: hidden;">({{ obj.apply_user.real_name }})</span><br>
                    结束
                </div>
                <div style="width: 50px;height: 25px;border-radius: 3px;background: #0d8ddb;color: white;text-align: center;display: inline-block;font-size: 12px;line-height: 25px;">
                    ending
                </div>
            </div>
        </div>
    </div>

    <div id="LH" style="width: 100%;height: 94%;background: white;display: none;">
        <div style="display: inline-block;width: 20%;vertical-align: top;height: 99%">
            <div style="width: 100%;height: 40px;background: #c8cbcf;padding-left: 2%;line-height: 40px;color: #0c6fd9;">
                附件
            </div>
            <div style="width: 100%;">
                {% for item in main_file_list %}
                    <div><a href="#" class="a_tag_cla" onclick="chage_yulan(this, '{{ item.file_path }}')">{{ item.file_name }}</a></div>
                {% endfor %}
            </div>

        </div>
        <div style="display: inline-block;width: 78%;vertical-align: top;height: 99%;text-align: center;" id="fujian">
            {% if 'jpg' in file_path or 'JPG' in file_path or 'JPEG' in file_path or 'jpeg' in file_path or 'PNG' in file_path or 'png' in file_path %}
                <img src="{{ file_path }}" alt="" style="width: 800px;height: 100%;">
            {% else %}
                <embed id="embed_file" src="{{ file_path }}" type="application/pdf" style="width: 100%;height: 100%;">
            {% endif %}
        </div>
    </div>

    <div id="new_models1" style="width: 100%;height: 100%;position: absolute;background-color: rgba(36, 36, 36, 0.3);z-index: 11000;top: 0;left: 0;display: none;">
        <div id="addForm">
            <!-- 标题 -->
            <div id="title">
                <h5 style="line-height: 50px;width: 15%;margin-left: 1%;display: inline-block;font-size: 18px;">被授权人员</h5>
                <div class="search" style="vertical-align: center;display: inline-block;text-align: right;margin-left: 35%;font-size: 14px;">
                    <input type="text" placeholder="请输入..." name="" id="search_data" value="">
                    <button id="search_button">搜索</button>
                </div>
                <span onclick="close_models1()" style="float: right;line-height: 50px;padding-right: 2%;cursor: pointer;"><i class="iconfont icon-quchu"></i></span>
            </div>
            <hr>
            <div style="display: inline-block;width: 30%;height: 350px;border-right: #E8E8E8 solid 1px;">
                <div style="width: 100%;height: 35px;line-height: 35px;padding-left: 2%;color: #0b0b0b;border-bottom: #cfcfcf solid 1px;font-size: 14px;">
                    <div id="an_branch"
                         style="width: 31.5%;display: inline-block;cursor: pointer;text-align: center;color: #01aaed;">
                        按部门
                    </div>
                    <div id="an_rank"
                         style="width: 31.5%;display: inline-block;cursor: pointer;text-align: center;">按权限
                    </div>
                    <div id="an_func"
                         style="width: 31.5%;display: inline-block;cursor: pointer;text-align: center;">按职能
                    </div>
                </div>
                <div id="department_list" style="width: 100%;height: 315px;overflow: auto;">
                    <div style="width: 100%;height: 100%;text-align: center;">
                        <img style="width: 30%;height: 30%;margin-top: 35%;"
                             src="../../static/public_file/images/jiazai.gif" alt="">
                    </div>
                </div>
            </div>

            <div style="display: inline-block;width: 69.5%;height: 350px;overflow: auto;vertical-align: top;left: 0;font-size: 14px;">
                <table class="table table-hover table-bordered"
                       style="border-collapse: collapse;margin: 0;padding: 0;">
                    <thead>
                    <tr>
                        <th scope="col" style="width: 10%;">
                            <input id="all_select_checkbox" type="checkbox">
                        </th>
                        <th scope="col" style="width: 20%;">序号</th>
                        <th scope="col" style="width: 35%;">姓名</th>
                        <th scope="col" style="width: 35%;">工号</th>
                    </tr>
                    </thead>
                    <tbody style="overflow: auto;" id="t_table2"></tbody>
                </table>
                <div id="img-display1" style="width: 75%;text-align: center;">
                    <div style="margin-top: 10%;">
                        <img src="../../static/public_file/images/page-img/11.jpg" alt="">
                        <p style="margin: 0;padding: 0;vertical-align: top;">暂无数据</p>
                    </div>
                </div>
            </div>

            <div style="height: 150px;width: 100%;border-top: #E8E8E8 solid 1px;overflow: auto;">
                <div id="checked-label" style="margin-top: 1%;margin-left: 3%;width: 90%;font-size: 14px;">

                </div>
            </div>
            <hr>
            <div style="height: 70px;padding-right: 2%;font-size: 14px;">
                <button onclick="choose_people()" id="model-affirm" style="border-radius: 3px;height: 30px;float: right;margin-top: 15px;border: #1E90FF solid 1px;background: #1E90FF;color: white;">
                    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;提&nbsp;交&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                </button>
            </div>
        </div>
    </div>

    <div id="addForm3" class="shade">
        <div id="addForm2">
            <div id="title2">
                <div style="line-height: 40px;cursor: move;width: 100%;padding-left: 2%;padding-right: 2%;">
                    <p style="float: left;font-size: 14px;">授权</p>
                    <i class="iconfont icon-quchu" onclick="model_close()" style="cursor: pointer;float: right;"></i>
                </div>
            </div>
            <div style="display: inline-block;width: 100%;height: 480px;border-right: #E8E8E8 solid 1px;font-size: 14px;line-height: 100px;text-align: center;border-bottom: #cfcfcf solid 1px;overflow: auto;">
                <table id="shouqian_table" style="width: 100%;">
                    <tr>
                        <th style="width: 8%;height: 35px;line-height: 35px;text-align: center;border-bottom: #cfcfcf solid 0.5px;border-right: #cfcfcf solid 0.5px;">序号</th>
                        <th style="width: 42%;height: 35px;line-height: 35px;text-align: center;border-bottom: #cfcfcf solid 0.5px;border-right: #cfcfcf solid 0.5px;">授权类目</th>
                        <th style="width: 42%;height: 35px;line-height: 35px;text-align: center;border-bottom: #cfcfcf solid 0.5px;border-right: #cfcfcf solid 0.5px;">授权类型</th>
                        <th style="width: 8%;height: 35px;line-height: 35px;text-align: center;border-bottom: #cfcfcf solid 0.5px;">删除</th>
                    </tr>
                    <tr>
                        <td class="xuhao_td" style="width: 8%;text-align: center;height: 35px;line-height: 35px;border-bottom: #cfcfcf solid 0.5px;border-right: #cfcfcf solid 0.5px;">1</td>
                        <td class="shouquanleixing" style="width: 42%;text-align: left;height: 35px;line-height: 35px;padding-left: 0.5%;border-bottom: #cfcfcf solid 0.5px;border-right: #cfcfcf solid 0.5px;" contenteditable="true"></td>
                        <td style="width: 42%;text-align: center;height: 35px;line-height: 35px;padding-left: 0.5%;border-bottom: #cfcfcf solid 0.5px;border-right: #cfcfcf solid 0.5px;">
                            {% if obj.authorization_type == '法人授权' %}
                                <input type="radio" name="type-1" value="1"> 一级授权<input type="radio" name="type-1" style="margin-left: 10px;" value="2"> 二级授权<input type="radio" name="type-1" style="margin-left: 10px;" value="3"> 三级授权
                            {% else %}
                                <input type="radio" name="type-1" value="1"> 一级授权<input type="radio" name="type-1" style="margin-left: 10px;" value="2"> 二级授权
                            {% endif %}
                        </td>
                        <td style="width: 8%;text-align: center;height: 35px;line-height: 35px;padding-left: 0.5%;border-bottom: #cfcfcf solid 0.5px;">
                            <img src="../../static/personal_center/img/02删除-填充.png" alt="" style="width: 25px;height: 25px;vertical-align: top;margin-top: 5px;cursor: pointer;" onclick="remove_category(this)">
                        </td>
                    </tr>
                </table>
                <div style="width: 100%;height: 35px;text-align: center;cursor: pointer;" onclick="add_category()">
                    <img src="../../static/personal_center/img/添加_填充.png" alt="" style="width: 25px;height: 25px;vertical-align: top;margin-top: 5px;cursor: pointer;">
                </div>
            </div>
            <div style="width: 100%;height: 40px;text-align: left;padding-left: 2%;font-size: 14px;border-bottom: #DFDFDF solid 0.5px;color: red;line-height: 40px;">
                {% if obj.authorization_type == '法人授权' %}
                    备注：一级授权，法人授权；二级授权，分管领导授权；三级授权，科室负责人授权；
                {% else %}
                    备注：一级授权，分管领导授权；二级授权，科室负责人授权；
                {% endif %}
            </div>
            <div style="width: 100%;height: 40px;text-align: right;padding-right: 2%;font-size: 14px;">
                <button id="QuerenHsouquan" style="width: 70px;height: 30px;margin-top: 5px;border-radius: 3px;border: #00a0e9 solid 0.5px;background: #00a0e9;color: white;line-height: 30px;">确认</button>
            </div>
        </div>
    </div>
{% endblock %}

{% block script %}
    <script src="../../static/system_setup/creat_from/js/jquery-1.10.2.js"></script>
    <script language="javascript" src="../../static/personal_center/js/jquery.jqprint-0.3.js"></script>
    <script>
        const uuid = "{{ obj.fj_number | safe }}"
        const is_upload = "{{ is_upload }}"         // 判断流程最后上传支付凭证参数
        const is_edit = '{{ is_edit }}'             // 判断是否可以修改参数
        window.onload = function () {
            document.getElementById("loading").style.display = "none";
            document.getElementById("personage").className = "add_class";
            document.getElementById("sponsor").className = "add-nav-active";
        };

        function change_mind(ele_id) {
            if (ele_id === "DW") {
                document.getElementById("DW").style.display = "inline-block";
                document.getElementById("DW_tag").className = "tab_top top_tag";
                document.getElementById("LH_tag").className = "tab_top";
                document.getElementById("LH").style.display = "none";
                document.getElementById("lct_tag").className = "tab_top";
                document.getElementById("lct").style.display = "none";
            } else if (ele_id === "LH") {
                document.getElementById("LH").style.display = "inline-block";
                document.getElementById("LH_tag").className = "tab_top top_tag";
                document.getElementById("DW_tag").className = "tab_top";
                document.getElementById("DW").style.display = "none";
                document.getElementById("lct_tag").className = "tab_top";
                document.getElementById("lct").style.display = "none";
            } else {
                document.getElementById("lct").style.display = "inline-block";
                document.getElementById("lct_tag").className = "tab_top top_tag";
                document.getElementById("DW_tag").className = "tab_top";
                document.getElementById("DW").style.display = "none";
                document.getElementById("LH_tag").className = "tab_top";
                document.getElementById("LH").style.display = "none";
            }
        }

        function chage_yulan(this_, file_path) {
            var fujian = document.getElementById("fujian");
            var file_index = file_path.lastIndexOf(".")
            var ext = file_path.substring(file_index+1)
            var arr=['jpg', 'JPG', "JPEG", "jpeg", "PNG", "png"];
            var ext_index=arr.indexOf(ext);
            if (ext_index === -1){
                fujian.innerHTML = '<embed id="embed_file" src="'+file_path+'" type="" style="width: 100%;height: 100%;">'
            }else {
                fujian.innerHTML = '<img src="' + file_path + '" alt="application/pdf" style="width: 800px;height: 100%;">'
            }

            var a_tag_list = document.getElementsByClassName("a_tag_cla");
            for (var i = 0;i<a_tag_list.length; i++){
                a_tag_list[i].style.background='';
            }
            this_.style.background='#cfcfcf';
        }


        function page_zhanshi() {
            document.getElementById('page_one').style.display = 'inline-block';
        }

        function page_yincang() {
            document.getElementById('page_one').style.display = 'none';
        }

        function online_tag() {
            document.getElementById("new_models").style.display = "table-row";
        }

        function close_models() {
            document.getElementById("new_models").style.display = "none";
        }

        function summit_data(types='') {
            var present_id = '{{ obj.id }}';
            var states = '{{ obj.state }}';
            var ApprovalType = '{{ ApprovalType }}';
            if (!types) {
                var approve = $("input[type=radio][name=approve]:checked").val();
                var audit_note = document.getElementById("opinion_detail").value;
                if (approve === "draft") {
                    if (!audit_note) {
                        alert("不同意请填写理由！");
                        return false
                    }
                }
                var note_str = "id=" + present_id + "&state=" + String(approve) + "&audit_note=" + String(audit_note)
            }else {
                note_str = "id=" + present_id + "&state=audit&audit_note=&ApprovalType="+ApprovalType
            }

            document.getElementById("loading").style.display = "inline-block";
            var xhr = new XMLHttpRequest();
            var local_host = window.location.host;          // 获取当前IP
            xhr.open('post', "/finance/QuickAuthorizationDetail.html");
            xhr.setRequestHeader('content-type', 'application/x-www-form-urlencoded');
            xhr.setRequestHeader('Access-Control-Allow-Origin', '*');
            xhr.send(note_str);
            xhr.onreadystatechange = function () {
                if (xhr.readyState === 4) {
                    if (xhr.status === 200) {
                        document.getElementById("loading").style.display = "none";
                        var JsonDate = JSON.parse(xhr.responseText);
                        if (JsonDate["code"] === 200) {
                            alert(JsonDate["message"]);
                            window.location.href = '/personal-center/process_management.html?type=我的待办&folw_type=&folw=&page=1&page_size=20&wd='
                        } else {
                            alert(JsonDate["message"]);
                        }
                    }
                }
            };
        }

        function ExportCar() {
            var shenqing_type = '{{ obj.authorization_type | safe }}';
            if (shenqing_type === "法人授权") {
                var seal_check = document.getElementsByName("choose_seal");
                var leimuxuhao_list = document.getElementsByClassName("leimuxuhao")
                var detail_json = []
                for (var i=0; i<seal_check.length; i++) {
                    var neirong = document.getElementsByClassName("AuthorizedCategories"+leimuxuhao_list[i].innerText)
                    var AuthorizedType = document.getElementsByClassName("AuthorizedType"+leimuxuhao_list[i].innerText)
                    var leirong_list = []
                    for (var tt=0; tt<neirong.length; tt++) {
                        var Type_S = AuthorizedType[tt].innerText;
                        if (Type_S === "一级授权") {
                            var Type_Number = "1"
                        }else if (Type_S === "二级授权") {
                            Type_Number = "2"
                        }else if (Type_S === "三级授权") {
                            Type_Number = "3"
                        }else {
                            alert("请选择授权类型！");
                            return false
                        }
                        leirong_list.push({"neirong": neirong[tt].innerText, "type": Type_Number})
                    }
                    detail_json.push({"xuhao": leimuxuhao_list[i].innerText, "yinzhang": parseInt(seal_check[i].value), 'neirong': leirong_list})
                }
            }else {
                neirong = document.getElementsByClassName("AuthorizedCategories1")
                AuthorizedType = document.getElementsByClassName("AuthorizedType1")
                leirong_list = []
                detail_json = []
                for (var jj=0; jj<neirong.length; jj++) {
                    Type_S = AuthorizedType[jj].innerText;
                    if (Type_S === "一级授权") {
                        Type_Number = "1"
                    }else if (Type_S === "二级授权") {
                        Type_Number = "2"
                    }else {
                        Type_Number = "3"
                    }
                    leirong_list.push({"neirong": neirong[jj].innerText, "type": Type_Number})
                }
                detail_json.push({"xuhao": '1', "yinzhang": 1, 'neirong': leirong_list})
            }
            var authorization_type = document.getElementById("shenqing_type").innerText;
            document.getElementById("loading").style.display = "inline-block";
            var xhr = new XMLHttpRequest();
            var local_host = window.location.host;          // 获取当前IP
            xhr.open('post', "/finance/QuickAuthorizationIndex.html", true);
            xhr.setRequestHeader('content-type', 'application/x-www-form-urlencoded');
            xhr.send("detail_json=" + JSON.stringify(detail_json)+"&id="+'{{ obj.id }}'+"&authorization_type="+authorization_type);
            xhr.onreadystatechange = function () {
                if (xhr.readyState === 4) {
                    if (xhr.status === 200) {
                        var JsonDate = JSON.parse(xhr.responseText);
                        if (JsonDate["code"] === 200) {
                            alert("修改成功");
                            window.location = "/finance/QuickAuthorizationList.html";
                        } else {
                            alert(JsonDate['message']);
                            document.getElementById("loading").style.display = "none";
                        }
                    }
                }
            };
        }

        function operate_button(ele_id) {
            var id = '{{ obj.id }}'
            if (ele_id === 'is_stop') {
                var state = 'stop';     // 终止
                var word = '终止'
            } else if (ele_id === 'is_cancel') {
                state = 'cancel';       // 作废
                word = '作废'
            } else {
                state = 'recall'
                word = '撤回'
            }
            var r = confirm('是否' + word + '流程？')
            if (r === true) {
                var xhr = new XMLHttpRequest();
                var local_host = window.location.host;          // 获取当前IP
                xhr.open('post', "/finance/QuickAuthorizationStop.html", true);
                xhr.setRequestHeader('content-type', 'application/x-www-form-urlencoded');
                xhr.send("state=" + state + "&id=" + id)
                xhr.onreadystatechange = function () {
                    if (xhr.readyState === 4) {
                        if (xhr.status === 200) {
                            document.getElementById("loading").style.display = "none";
                            var JsonDate = JSON.parse(xhr.responseText);
                            console.log(JsonDate);
                            alert(JsonDate['message'])
                            window.location.href = "/finance/QuickAuthorizationList.html"
                        }
                    }
                };
            }
        }

        function print_topics() {
            $('#menu_from').jqprint({
                debug: false,
                importCSS: true,
                printContainer: true,
                operaSupport: false
            });
        }

        let title3 = document.querySelector("#box");
        let addForm3 = document.querySelector("#share");

        title3.addEventListener("mousedown", function (e) {
            let x = e.pageX - addForm3.offsetLeft;
            let y = e.pageY - addForm3.offsetTop;


            document.addEventListener("mousemove", move);
            function move(e) {
                addForm3.style.left = e.pageX - x + 'px';
                addForm3.style.top = e.pageY - y + 'px';
            }

            document.addEventListener("mouseup", function (e) {
                document.removeEventListener("mousemove", move);
            })
        })

        let title1 = document.querySelector("#title");
        let addForm1 = document.querySelector("#addForm");



        title1.addEventListener("mousedown", function (e) {
            let x = e.pageX - addForm1.offsetLeft;
            let y = e.pageY - addForm1.offsetTop;


            document.addEventListener("mousemove", move);
            function move(e) {
                addForm1.style.left = e.pageX - x + 'px';
                addForm1.style.top = e.pageY - y + 'px';
            }

            document.addEventListener("mouseup", function (e) {
                document.removeEventListener("mousemove", move);
            })
        });

        function close_models1() {
            document.getElementById("new_models1").style.display = "none";
        }

        function fill_val() {
            document.getElementById("new_models1").style.display="table-row";
            sessionStorage.clear();
            document.getElementById("an_branch").style.color = "#01aaed";
            document.getElementById("an_rank").style.color = "#0b0b0b";
            document.getElementById("an_func").style.color = "#0b0b0b";
            document.getElementById("all_select_checkbox").checked = false;
            var check_box_list = document.getElementsByClassName("check_box");
            document.getElementById("search_button").setAttribute("onclick", "search_data()");
            document.getElementById("an_branch").setAttribute("onclick", "change_left_val(this.id)");
            document.getElementById("an_rank").setAttribute("onclick", "change_left_val(this.id)");
            document.getElementById("an_func").setAttribute("onclick", "change_left_val(this.id)");
            for (var t = 0; t < check_box_list.length; t++) {
                document.getElementById(check_box_list[t].id).checked = false;
            }
            document.getElementById("checked-label").innerHTML = "";

            deltr1();
            document.getElementById("img-display1").style.display = "inline-block";
            if (window.branch_list) {
                var branch_list = window.branch_list;
                var department_list = document.getElementById("department_list");
                department_list.innerHTML = "";
                var ul_tag = document.createElement("ul");
                ul_tag.style.fontSize = "0";
                ul_tag.style.margin = "0";
                ul_tag.style.padding = "0";
                for (var i = 0; i < branch_list.length; i++) {
                    var li_tag = document.createElement("li");
                    li_tag.style.fontSize = "14px";
                    li_tag.style.margin = "0";
                    li_tag.style.padding = "0";
                    li_tag.innerHTML = "<p style='margin-left: 20%;'>" + branch_list[i] + "</p>";
                    li_tag.setAttribute("onclick", "choice_peopel('" + branch_list[i] + "')");
                    li_tag.setAttribute("id", branch_list[i]);
                    li_tag.className = "li-class";
                    ul_tag.appendChild(li_tag);
                    department_list.appendChild(ul_tag);
                }
            } else {
                var xhr = new XMLHttpRequest();
                var local_host = window.location.host;          // 获取当前IP
                xhr.open('post', "/technological/delegation", true);
                xhr.setRequestHeader('content-type', 'application/x-www-form-urlencoded');
                xhr.send();
                xhr.onreadystatechange = function () {
                    if (xhr.readyState === 4) {
                        if (xhr.status === 200) {
                            var JsonDate = JSON.parse(xhr.responseText);
                            window.personnel_list = JsonDate["data"];
                            window.emp_info_dict = JsonDate["emp_info_dict"];
                            window.people_dict = JsonDate["people_dict"];
                            window.people_dict_new = JsonDate["people_dict_new"];
                            window.branch_list = JsonDate["branch_list"];
                            window.function_list = JsonDate["function_list"];
                            var department_list = document.getElementById("department_list");
                            department_list.innerHTML = "";
                            var ul_tag = document.createElement("ul");
                            ul_tag.style.fontSize = "0";
                            ul_tag.style.margin = "0";
                            ul_tag.style.padding = "0";
                            for (var i = 0; i < JsonDate["branch_list"].length; i++) {
                                var li_tag = document.createElement("li");
                                li_tag.style.fontSize = "14px";
                                li_tag.style.margin = "0";
                                li_tag.style.padding = "0";
                                li_tag.innerHTML = "<p style='margin-left: 20%;'>" + JsonDate["branch_list"][i] + "</p>";
                                li_tag.setAttribute("onclick", "choice_peopel('" + JsonDate["branch_list"][i] + "')");
                                li_tag.setAttribute("id", JsonDate["branch_list"][i]);
                                li_tag.className = "li-class";
                                ul_tag.appendChild(li_tag);
                                department_list.appendChild(ul_tag);
                            }
                        }
                    }
                }
            }
        }

        // 删除列表
        function deltr1() {
            var tb = document.getElementById('t_table2');
            var rowNum = tb.rows.length;
            for (i = 0; i < rowNum; i++) {
                tb.deleteRow(i);
                rowNum = rowNum - 1;
                i = i - 1;
            }
        }

        function choice_peopel(choice_key, chose_id) {
            var data_str = sessionStorage.getItem(choice_key);
            var data_list = [];
            if (data_str) {
                data_list = data_str.split(",")
            }
            var emp_info_dict = window.emp_info_dict;
            document.getElementById("img-display1").style.display = "none";
            var t_table = document.getElementById("t_table2");
            if (document.getElementsByClassName("li-class add_background").length > 0) {
                var old_tag_id = document.getElementsByClassName("li-class add_background")[0].id;
                document.getElementById(old_tag_id).className = "li-class";
            }
            document.getElementById(choice_key).className = "li-class add_background";
            deltr1();
            document.getElementById("all_select_checkbox").checked = false;
            document.getElementById("all_select_checkbox").setAttribute("onclick", "check_all_select('" + choice_key + "', '" + chose_id + "')");

            for (var i = 0; i < emp_info_dict[choice_key].length; i++) {
                var elm = emp_info_dict[choice_key]
                var tr = document.createElement("tr");
                var td = document.createElement("td");
                var td1 = document.createElement("td");
                var td2 = document.createElement("td");
                var td3 = document.createElement("td");
                td.innerHTML = "<input id='" + elm[i].real_name + "(" + elm[i].job_number + ')' + "' class='check_box' type=\"checkbox\" onclick='choice_consignor(this.id, \"" + chose_id + "\"" + ", \"" + choice_key + "\")'>";
                td.style.textAlign = "center";
                td1.innerHTML = i + 1;
                td1.style.textAlign = "center";
                td2.innerHTML = elm[i].real_name;
                td2.title = elm[i].real_name;
                td2.style.textAlign = "center";
                td3.innerHTML = elm[i].job_number;
                td3.title = elm[i].job_number;
                td3.style.textAlign = "center";
                tr.appendChild(td);
                tr.appendChild(td1);
                tr.appendChild(td2);
                tr.appendChild(td3);
                t_table.appendChild(tr);
            }

            var tttt = 0;
            if (data_list) {
                if (data_list[0] === "all") {
                    document.getElementById("all_select_checkbox").checked = true;
                    tttt = 1
                }
            }
            for (var III = tttt; III < data_list.length; III++) {
                document.getElementById(data_list[III].trim()).checked = true;
            }
        }

        // 选择委托人
        function choice_consignor(ele_id, chose_id, choice_key) {
            var check_box_list = document.getElementsByClassName("check_box");
            for (var jjj=0; jjj<check_box_list.length; jjj++) {
                check_box_list[jjj].checked=false;
            }
            document.getElementById(ele_id).checked=true;
            chose_id = 'executor2';
            if (chose_id === "executor2" || chose_id === "executor4") {
                var dataStr = sessionStorage.getItem(choice_key);
                var dataList = [];
                if (dataStr) {
                    sessionStorage.setItem(choice_key, dataStr + ", " + ele_id)
                } else {
                    sessionStorage.setItem(choice_key, ele_id)
                }

                if (chose_id === "executor2") {
                    var tag_id = "executor_str";
                } else {
                    tag_id = "executor_str1";
                }
                var executor_str = document.getElementById(tag_id);
                if (executor_str) {
                    if (document.getElementById(ele_id).checked) {
                        document.getElementById(tag_id).innerHTML = ele_id;
                    } else {
                        var str_push = [];
                        var executor_list = executor_str.innerText.split(", ");
                        for (var kl = 0; kl < executor_list.length; kl++) {
                            if (executor_list[kl] !== ele_id) {
                                str_push.push(executor_list[kl])
                            }
                        }
                        document.getElementById(tag_id).innerHTML = str_push.join(", ")
                    }
                } else {
                    document.getElementById("checked-label").innerHTML = "<span id='" + tag_id + "' style='margin-left: 1%;width: 100%;'>" + ele_id + "</span>";
                }
            } else {
                check_more_one_not(ele_id);
                document.getElementById("checked-label").innerHTML = "<span id='" + tag_id + "' style='margin-left: 1%;'>" + ele_id + "</span>";
            }

        }

        // 复选框全选
        function check_all_select(choice_key, chose_id) {
            var select_check = document.getElementById("all_select_checkbox").checked;
            var all_check_box = document.getElementsByClassName("check_box");
            chose_id = 'executor2'
            if (chose_id === "executor2") {
                var tag_id = "executor_str";
            } else {
                tag_id = "executor_str1";
            }

            var executor_list = [];
            var executor_str = document.getElementById(tag_id);
            if (executor_str) {
                if (executor_str.innerText.trim()) {
                    executor_list = executor_str.innerText.split(", ")
                }
            }

            var new_check_val_list = [];
            var check_val_list = [];
            for (var HH = 0; HH < all_check_box.length; HH++) {
                all_check_box[HH].checked = true;
                check_val_list.push(all_check_box[HH].id);
                if (executor_list.lastIndexOf(all_check_box[HH].id) === -1) {
                    new_check_val_list.push(all_check_box[HH].id)
                }
            }

            if (select_check) {
                if (chose_id === "executor2" || chose_id === "executor4") {

                    if (executor_str) {
                        if (executor_str.innerText.trim()) {
                            document.getElementById(tag_id).innerHTML = executor_str.innerText + ", " + new_check_val_list.join(", ");
                        } else {
                            document.getElementById(tag_id).innerHTML = new_check_val_list.join(", ");
                        }

                    } else {
                        document.getElementById("checked-label").innerHTML = "<span id='" + tag_id + "' style='margin-left: 1%;width: 100%;'>" + check_val_list.join(", ") + "</span>";
                    }
                    sessionStorage.setItem(choice_key, "all" + ", " + check_val_list.join(", "))
                } else {
                    alert("该节点不能多选！");
                    document.getElementById("all_select_checkbox").checked = false;
                }
            } else {
                sessionStorage.removeItem(choice_key);
                check_val_list = [];
                for (var II = 0; II < all_check_box.length; II++) {
                    all_check_box[II].checked = false;
                    check_val_list.push(all_check_box[II].id);
                }
                var old_check_val = document.getElementById(tag_id).innerHTML.split(", ");
                console.log(old_check_val)
                for (var TB = 0; TB < check_val_list.length; TB++) {
                    removeByValue(old_check_val, check_val_list[TB])
                }

                document.getElementById(tag_id).innerHTML = old_check_val.join(", ");
            }
        }

        function removeByValue(arr, val) {
            for (var i = 0; i < arr.length; i++) {
                if (arr[i] === val) {
                    arr.splice(i, 1);
                    break;
                }
            }
        }

        function choose_people() {
            var executor111 = '';
            var checked_label = document.getElementById("checked-label");
            for (var j = 0; j < checked_label.children.length; j++) {
                executor111 = executor111 + checked_label.children[j].innerText.trim() + ", ";
            }
            document.getElementById("new_models1").style.display = "none";
            var executor = executor111.slice(0, -2);
            document.getElementById("conferee").value = executor;
        }

        function search_data() {
            var searchData = document.getElementById("search_data").value;
            var emp_info_dict = window.emp_info_dict;
            console.log(emp_info_dict);
            var searchValNum = 1;
            var department_list = document.getElementById("department_list");
            document.getElementById("all_select_checkbox").checked = false;
            document.getElementById("all_select_checkbox").setAttribute("onclick", "check_all_select('all')");
            document.getElementById("img-display1").style.display = "none";
            var t_table = document.getElementById("t_table2");
            t_table.innerHTML="";
            for (var i in emp_info_dict){
                for (var j=0; j<emp_info_dict[i].length; j++){
                    if (emp_info_dict[i][j]["real_name"].indexOf(searchData) !== -1){
                        var elm = emp_info_dict[i];
                        var tr = document.createElement("tr");
                        var td = document.createElement("td");
                        var td1 = document.createElement("td");
                        var td2 = document.createElement("td");
                        var td3 = document.createElement("td");
                        {#console.log('elm[i]', elm[i])#}
                        td.innerHTML = "<input id='" + elm[j].real_name + "(" + elm[j].job_number + ')' + "' class='check_box' type=\"checkbox\" onclick='choice_consignor(this.id, \"" + i + "\")'>";
                        td.style.textAlign = "center";
                        td1.innerHTML = searchValNum;
                        td1.style.textAlign = "center";
                        td2.innerHTML = elm[j].real_name;
                        td2.title = elm[j].real_name;
                        td2.style.textAlign = "center";
                        td3.innerHTML = elm[j].job_number;
                        td3.title = elm[j].job_number;
                        td3.style.textAlign = "center";
                        tr.appendChild(td);
                        tr.appendChild(td1);
                        tr.appendChild(td2);
                        tr.appendChild(td3);
                        t_table.appendChild(tr);
                        searchValNum += 1;
                    }
                }
            }
        }

        function add_other() {
            var leimuxuhao_count =  document.getElementsByClassName("leimuxuhao").length + 1;
            var html = `<tr style="margin-left: 1%;">
                            <td id='leimuxuhao`+String(leimuxuhao_count)+`' class="leimuxuhao" style="width: 5%;border: #cfcfcf solid 0.5px;text-align: center;height: 35px;line-height: 35px;">`+String(leimuxuhao_count)+`</td>
                            <td style="width: 25%;border: #cfcfcf solid 0.5px;text-align: center;height: 35px;line-height: 35px;">
                                <select name="choose_seal" class="AuthorizedSeal`+String(leimuxuhao_count)+`" style="width: 100%;height: 100%;border: none;outline: none;">
                                    {% for seal in seal_obj %}
                                        <option value="{{ seal.id }}" style="text-align: center;">{{ seal.seal_name }}</option>
                                    {% endfor %}
                                </select>
                            </td>
                            <td class="leimuneirong" id="span_`+String(leimuxuhao_count)+`" onclick="model_inline(this.id)" style="width: 50%;border: #cfcfcf solid 0.5px;height: 35px;line-height: 35px;color: #CCCCCC;cursor: pointer;">
                                请填写授权类型
                            </td>
                            <td style="width: 20%;border: #cfcfcf solid 0.5px;text-align: left;height: 35px;line-height: 35px;cursor: pointer;">
                                <div id="shouquan_type_`+String(leimuxuhao_count)+`" style="padding-left: 10px;outline: none;display: -moz-inline-box; display: inline-block;width:80%;white-space:pre-wrap;text-align: left;"></div>
                                <span onclick="remove_time_adress(this)" style="color: red; cursor: pointer; display: inline-block;">删除</span>
                            </td>
                        </tr>`
            $("#leimuId").append(html);
        }

        function remove_time_adress(obj) {
            var trNode = $(obj).parent().parent();
            trNode.remove();
            var xuhao_list = document.getElementsByClassName("leimuxuhao");
            for (var i=0; i<xuhao_list.length; i++) {
                xuhao_list[i].innerText=i+1
            }
        }

        let title2 = document.querySelector("#title2");
        let addForm2 = document.querySelector("#addForm2");
        title2.addEventListener("mousedown", function (e) {
            let x = e.pageX - addForm2.offsetLeft;
            let y = e.pageY - addForm2.offsetTop;


            document.addEventListener("mousemove", move);
            function move(e) {
                addForm2.style.left = e.pageX - x + 'px';
                addForm2.style.top = e.pageY - y + 'px';
            }

            document.addEventListener("mouseup", function (e) {
                document.removeEventListener("mousemove", move);
            })
        });

        function model_inline(this_eve) {
            var inner_str = document.getElementById(this_eve).innerText;
            var shouquanleixing_list = document.getElementsByClassName("shouquanleixing");
            for (var t=0; t<shouquanleixing_list.length; t++) {
                shouquanleixing_list[t].innerHTML='';
             }
            {#if (inner_str !== "请填写授权类型") {#}
            {#    var str_list = inner_str.split("\n");#}
            {#    for (var i=0; i<str_list.length; i++) {#}
            {#        if (str_list[i].trim()){#}
            {#            shouquanleixing_list[i].innerHTML = str_list[i].split("、")[1]#}
            {#        }#}
            {#    }#}
            {# }#}
            document.getElementById("addForm3").style.display="table-row";
            document.getElementById("QuerenHsouquan").setAttribute("onclick", "queren_hsouquan('"+this_eve+"')")
        }

        function model_close() {
            document.getElementById("addForm3").style.display="none";
        }

        function queren_hsouquan(this_eve) {
            document.getElementById(this_eve).innerText = "";
            document.getElementById(this_eve).style.color = "";
            document.getElementById("shouquan_type_"+this_eve.split("_")[1]).innerText = "";
            var xuhao_td = document.getElementsByClassName("xuhao_td");
            var shouquanleimu_list = document.getElementsByClassName("shouquanleixing");
            var shouquan_count = 1;var category_list = [];
            for (var i=0; i<shouquanleimu_list.length; i++) {
                var class_name = "type-"+xuhao_td[i].innerText
                var TypeS = $("input[type=radio][name="+class_name+"]:checked").val()
                if (String(TypeS) === "undefined") {
                    alert("请选择授权类型！");
                    return false
                }
                category_list.push({"xuhao": xuhao_td[i].innerText, "category": shouquanleimu_list[i].innerText, "Type": TypeS})
                shouquan_count += 1
            }

            for (var t=0; t<category_list.length; t++) {
                var p_str = `<p class="AuthorizedCategories`+this_eve.split("_")[1]+`" style="width: 100.5%;height: 30px;line-height: 30px;border-bottom: #DFDFDF solid 0.5px;font-size: 14px;">`+category_list[t]['category']+`</p>`
                var pinjie_id = "#"+this_eve
                $(pinjie_id).append(p_str)
                var pinjie_type = "#shouquan_type_"+this_eve.split("_")[1];
                if (category_list[t]['Type'] === '1') {
                    var categoryType = "一级授权";
                } else if (category_list[t]['Type'] === '2') {
                    categoryType = "二级授权";
                }else {
                    categoryType = "三级授权";
                }
                var p_tag_str = `<p class="AuthorizedType`+this_eve.split("_")[1]+`" style="width: 100%;height: 30px;line-height: 30px;border-bottom: #DFDFDF solid 0.5px;font-size: 14px;text-align: center;">`+categoryType+`</p>`;
                $(pinjie_type).append(p_tag_str)
            }
            model_close()
        }

        function add_category() {
            var tr_lenght = document.getElementsByClassName("shouquanleixing").length+1;
            var shenqing_type = '{{ obj.authorization_type | safe }}';
            if (shenqing_type === "法人授权"){
                var html_str = `
                        <tr>
                            <td class="xuhao_td" style="width: 8%;text-align: center;height: 35px;line-height: 35px;border-bottom: #cfcfcf solid 0.5px;border-right: #cfcfcf solid 0.5px;">`+String(tr_lenght)+`</td>
                            <td class="shouquanleixing" style="width: 42%;text-align: left;height: 35px;line-height: 35px;padding-left: 0.5%;border-bottom: #cfcfcf solid 0.5px;border-right: #cfcfcf solid 0.5px;" contenteditable="true"></td>
                            <td style="width: 42%;text-align: center;height: 35px;line-height: 35px;padding-left: 0.5%;border-bottom: #cfcfcf solid 0.5px;border-right: #cfcfcf solid 0.5px;">
                                <input type="radio" name="type-`+String(tr_lenght)+`" value="1"> 一级授权<input type="radio" name="type-`+String(tr_lenght)+`" style="margin-left: 10px;" value="2"> 二级授权<input type="radio" name="type-`+String(tr_lenght)+`" style="margin-left: 10px;" value="3"> 三级授权
                            </td>
                            <td style="width: 8%;text-align: center;height: 35px;line-height: 35px;padding-left: 0.5%;border-bottom: #cfcfcf solid 0.5px;">
                                <img src="../../static/personal_center/img/02删除-填充.png" alt="" style="width: 25px;height: 25px;vertical-align: top;margin-top: 5px;cursor: pointer;" onclick="remove_category(this)">
                            </td>
                        </tr>
                `
            }else {
                html_str = `
                        <tr>
                            <td class="xuhao_td" style="width: 8%;text-align: center;height: 35px;line-height: 35px;border-bottom: #cfcfcf solid 0.5px;border-right: #cfcfcf solid 0.5px;">`+String(tr_lenght)+`</td>
                            <td class="shouquanleixing" style="width: 42%;text-align: left;height: 35px;line-height: 35px;padding-left: 0.5%;border-bottom: #cfcfcf solid 0.5px;border-right: #cfcfcf solid 0.5px;" contenteditable="true"></td>
                            <td style="width: 42%;text-align: center;height: 35px;line-height: 35px;padding-left: 0.5%;border-bottom: #cfcfcf solid 0.5px;border-right: #cfcfcf solid 0.5px;">
                                <input type="radio" name="type-`+String(tr_lenght)+`" value="1"> 一级授权<input type="radio" name="type-`+String(tr_lenght)+`" style="margin-left: 10px;" value="2"> 二级授权
                            </td>
                            <td style="width: 8%;text-align: center;height: 35px;line-height: 35px;padding-left: 0.5%;border-bottom: #cfcfcf solid 0.5px;">
                                <img src="../../static/personal_center/img/02删除-填充.png" alt="" style="width: 25px;height: 25px;vertical-align: top;margin-top: 5px;cursor: pointer;" onclick="remove_category(this)">
                            </td>
                        </tr>
                `
            }
            $("#shouqian_table").append(html_str);
        }

        function remove_category(obj) {
            var trNode = $(obj).parent().parent();
            trNode.remove();
            var tr_lenght = document.getElementsByClassName("shouquanleixing").length;
            var xuhao_td = document.getElementsByClassName("xuhao_td")

            for (var i=0; i<tr_lenght; i++) {
                xuhao_td[i].innerText = i+1;
            }
        }
    </script>
{% endblock %}
